// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

import store from './store/store.js';

// 引入axios
import axios from 'axios'
Vue.prototype.$ajax = axios
axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'

// 引入公用js
import utils from './utils/utils.js';
Vue.prototype.$utils = utils

// 引入mint-ui
import Mint from 'mint-ui';
Vue.use(Mint);
import 'mint-ui/lib/style.css'; 
import {Toast,MessageBox, Indicator} from 'mint-ui';
Vue.prototype.$toast = Toast;
Vue.prototype.$messagebox = MessageBox;
Vue.prototype.$indicator = Indicator;

// 引入swiper
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
Vue.use(VueAwesomeSwiper, /* { default global options } */)
Vue.config.productionTip = false


/* 全局注册组件 */
import headerbox from '@/components/header_footer/headerbox';
Vue.component('headerbox', headerbox)
import footerNav from '@/components/header_footer/footerbox';
Vue.component('footerNav', footerNav)
import noData from '@/components/noData';
Vue.component('noData', noData)
// import noneList from '@/components/noneList/noneList';
// Vue.component('noneList',noneList)


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  let m_openid = sessionStorage.getItem('m_openid');
  // if(m_openid == undefined && to.path != '/author'){
  //   // 第一次进入项目
  //   sessionStorage.setItem('beforeLoginUrl', to.fullPath) // 保存用户进入的url
  //   next('/author')
  //   return false
  // }
  next()
})